/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 *
 */

import * as path from 'path';

import { isWindows } from '@ohos/hvigor-common';

import { getHvigorUserHomeCacheDir } from '../../common/util/hvigor-user-home.js';

export const HVIGOR_PACKAGE_NAME = require('../../../package.json').version;
export const CUR_HVIGOR_VERSION = require('../../../package.json').version;
export const COMMAND_DESCRIPTION = require('../../base/command/constants.json');
// 该文件中定义的场景变动需谨慎和评审,需要同步到vigor-wrapper和IDE中!!!
export const HVIGOR_PROJECT_ROOT_DIR = process.cwd();
export const DEFAULT_PROJECT_NODE_PATH: string | undefined = process.env.NODE_PATH;

export const PNPM_TOOL = isWindows() ? 'pnpm.cmd' : 'pnpm';

export const DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME = 'hvigor-config.json5';
export const DEFAULT_PACKAGE_JSON = 'package.json';
export const META_DATA_JSON = 'metadata.json';

export const HVIGOR_USER_HOME = getHvigorUserHomeCacheDir();
export const HVIGOR_WRAPPER_TOOLS_HOME = path.resolve(HVIGOR_USER_HOME, 'wrapper', 'tools');

export const HVIGOR_WRAPPER_PNPM_SCRIPT_PATH = path.resolve(HVIGOR_WRAPPER_TOOLS_HOME, 'node_modules', '.bin', PNPM_TOOL);
export const HVIGOR_PNPM_STORE_PATH = path.resolve(HVIGOR_USER_HOME, 'caches');

export const HVIGOR_PROJECT_WRAPPER_HOME = path.resolve(HVIGOR_PROJECT_ROOT_DIR, 'hvigor');

export const WORK_SPACE = 'workspace';
